
import { ref, getCurrentInstance } from "vue";

interface User {
  email: string;
  password: string;
}
export const loginUser = ref<User>({
  email: "912454064@qq.com",
  password: "123456",
});

interface Rules {
  email: {
    type: string;
    message: string;
    required: boolean;
    trigger: string;
  }[];
  password: ({
    message: string;
    required: boolean;
    trigger: string;
    min?: undefined;
    max?: undefined;
  } | {
    min: number;
    max: number;
    message: string;
    trigger: string;
    required?: undefined;
  })[];
}
// 校验规则
export const rules = ref<Rules>({
  email: [
    {
      type: "email",
      message: "Email in incorrect ...",
      required: true,
      trigger: "blur",
    },
  ],
  password: [
    {
      message: "Password could not be empty ...",
      required: true,
      trigger: "blur",
    },
    { min: 6, max: 30, message: "长度为6-30之间", trigger: "blur" },
  ],
});